package com.cci.kangdao.controller;

import com.cci.kangdao.service.CertifiedOwnerApplyService;
import com.cci.kangdao.utilTool.ParameterTool;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author linjiankun
 * @date 2023/3/3 8:52
 */
@Controller
public class CertifiedOwnerApplyController {


    private Logger log = Logger.getLogger(this.getClass().getName());

    @Autowired
    private CertifiedOwnerApplyService certifiedOwnerApplyService;

    /**
     * 提交认证车主申请接口
     * @param
     * @return
     */
    @RequestMapping("/submitCertifiedOwnerApply.aspx")
    public ModelAndView submitCertifiedOwnerApply(@RequestBody String paramStr, HttpServletRequest request, HttpServletResponse response) {
        try{
            Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
            map.put("request", request);
            map.put("response", response);
            certifiedOwnerApplyService.submitCertifiedOwnerApply(paramStr,request,response);
        }catch(Exception ex){
            log.error(ex.getMessage(),ex);

            String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
            ParameterTool.writeResponse(response, msg);
        }
        return null;
    }

}
